ServiceApplication Class

Used to create a service application, which runs in the background without a user interface.

Events

Continue

Pause

Stop


Properties

None

Methods

None

More information available in parent classes: ConsoleApplication:Object


Notes

A Service application is a special type of ConsoleApplication that is designed to run without any interface and even if are no users logged in. A Service application should not require any user interaction since it's possible that no user is logged in while your application is running. Typical examples of service applications are FTP servers, HTTP servers, and other types of servers that have no user interface.

Console applications rely on the Print and Input commands for communicating with the user. Services behave much the same (depending on how the service is installed, and on what operating system). For example, if your service is run as a daemon on Mac OS X or Linux using the inet.d scripts, then Print and Input will actually correspond to a socket that the system has already attached for you. This means that the Write method of the StandardOutputStream class will actually behave just like a socket and the Read method of the StandardInputStream class will as well.

It is worth noting that this behavior is not guaranteed for all operating systems. If you plan on deploying your service on multiple OS's, it is best to use a TCPSocket directly instead of relying on standard input and output being hooked up to a socket for you.

To create a service application, you must first create a regular console application. Choose File . New Project and choose the Console Application item. A console application, has a single project item called App whose super class is ConsoleApplication. Change App's super to ServiceApplication.

The ServiceApplication class is a subclass of ConsoleApplication class, so all the ConsoleApplication events and methods are available. In addition to the ConsoleApplication's events, there are three new events for a ServiceApplication. Some of these events will be fired only on operating systems that support them--and the only OS that supports them currently is Windows.


See Also

ConsoleApplication, StandardInputStream, StandardOutputStream classes; Input, Print, StdErr, StdIn, StdOut methods; TargetHasGUI constant.